$(document).ready(function(){
	//login.html=ajax
	$("#login_btn").bind('click',function(){
		var username=$("#login").val();
		var password=$("#pwd").val();
		if(username==""||password==""){
			alert('请输入账号或密码');
			return false;
		}
		$.ajax({
			url:"/News/index.php?c=user&a=login",
			type:"post",
			data:"username="+username+"&password="+password,
			dataType:"json",
			success:function(data){
				switch(data.status){
					case 1:
						location.href='/News/index.php';
						break;
					case -1:
						alert(data.msg);
						location.href='/News/index.php/user/login.html';
						break;
					case -2:
						$(".warning_pwd").html(" ");
						$(".warning_login").html(data.msg);
						break;
					case -3:
						$(".warning_login").html(" ");
						$(".warning_pwd").html(data.msg);
						break;
				}
			},
			error:function(jqXHR){
				alert(jqXHR.status);
			},
			cache:false,
			timeout:2000
		});
	})
	//
	$("body").bind('keydown',function(event){
		if(event.keyCode == 13){
			$("#login_btn").click();
		}
	});
	//list.php

	
	$(".del").bind('click',function(){
		if(!confirm('确认要删除？')){
			return false;
		}
	})
	
})
